import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedList;



public class Pile implements Serializable{
	  LinkedList<Integer> chemin;
	  
	public Pile(){
		chemin = new LinkedList<Integer>();
		
	}
	
    public LinkedList<Integer> getPile() {
		return chemin;
	}

	public void setChemin(LinkedList<Integer> chemin) {
		this.chemin = chemin;
	}

	public void empiler(Integer x){
		System.out.println("");
        this.chemin.addFirst(x);
    }
   
    public Integer depiler(){       
    	Integer x = chemin.getFirst();
        chemin.removeFirst();
        return x;
    }
   
    public Boolean pileVide(){
        return chemin.isEmpty();
    }
   
    public void ViderPile(){
        chemin.clear();
    }
   
    public Integer getTetePile(){
        return chemin.getFirst();
    }
   
    public Integer getQueuePile(){
        return chemin.getLast();
    }
    
    public Boolean estEnTeteDePile(String elt){
        return (chemin.getFirst().equals(elt));
    }
    public String toString(){
    	String c ="";
    	Iterator <Integer> i = chemin.iterator();
    	while(i.hasNext()){
    		Integer elt = i.next();
    		c = c+" , " +elt;		
    	}
    	return c;
    }
}